<?php
/**
 * IceMegaMenu Extension for Joomla 1.6 By IceTheme
 * 
 * 
 * @copyright	Copyright (C) 2008 - 2011 IceTheme.com. All rights reserved.
 * @license		GNU General Public License version 2
 * 
 * @Website 	http://www.icetheme.com/Joomla-Extensions/icemegamenu.html
 * @Support 	http://www.icetheme.com/Forums/IceMegaMenu/
 *
 */
 
 
$icemegamenu->render($params, 'modIceVerticalMenuXMLCallback');

if($use_js){
?>  
<script type="text/javascript">
    window.addEvent('domready', function() {
		if(document.getElementById('iceverticalmenu')!= null)
		var myVerticalMenu = new MenuMatic({id:'iceverticalmenu',
			subMenusContainerId: 'iceVerticalSubMenusContainer',
			effect:'<?php echo $js_effect;?>',
			duration:<?php echo $js_duration;?>,
			physics:<?php echo $js_physics;?>,
			orientation: 'vertical',
			hideDelay:<?php echo $js_hideDelay;?>,
			opacity:<?php echo $js_opacity;?>
		});
    });
</script>
<?php
 }
 else{
	?>
	<script language="javascript">
	if($$('.iceverticalmenu #iceverticalmenu .iceMenuLiLevel_1') ){
		$$('#iceverticalmenu .iceMenuLiLevel_1').getElements('ul.icesubMenu').each(function(item,index){
			item.setStyles({'display':'none','visibility':'visible'});
		});
	}
	window.addEvent('domready', function() {
		
		$$('.iceverticalmenu #iceverticalmenu .iceMenuLiLevel_1 ul.icesubMenu').each(function(el,index){
			el.getElement('li:first-child').addClass('loffirst');
		})
		
		$$('.iceverticalmenu #iceverticalmenu li').each(function(el,index){
			if( !el.hasClass("loffirst")){
				var li_id = el.getProperty("id");
				//if( li_id.match(/iceMenu+\d/) ){
					el.addEvents({
						mouseenter: function(){
							this.addClass('current');
							this.getElements('ul').setStyles({'display':'block'});
							this.getElements('ul li ul li ul').setStyles({'display':'none'});
						},
						mouseleave:function(){
							this.removeClass('current');
							this.getElements('ul.icesubMenu').setStyles({'display':'none'});
						}
					});
				//}
			}
		});
	});
</script>
	<?php
 }
?>